Skip to content

Conversation

@SachaProbo
Copy link
Contributor

@SachaProbo SachaProbo commented Oct 31, 2025

Summary by cubic

Added a proper download action to the PDF preview toolbar in Console and Trust. Clicking the inbox icon now downloads the PDF using the name prop (fallback: document.pdf) instead of zooming.

Written for commit 7da20b0. Summary will update automatically on new commits.

Signed-off-by: Sacha Al Himdani <[email protected]>
@SachaProbo SachaProbo requested a review from gearnode October 31, 2025 18:33
Copy link

@cubic-dev-ai cubic-dev-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

1 issue found across 2 files

Prompt for AI agents (all 1 issues)

Understand the root cause of the following 1 issues and fix them.


<file name="apps/console/src/components/documents/PDFPreview.tsx">

<violation number="1" location="apps/console/src/components/documents/PDFPreview.tsx:78">
Programmatic download fails in browsers like Firefox because the anchor is never added to the DOM before click(). Attach it to document.body before triggering the click and remove it afterward.</violation>
</file>

React with 👍 or 👎 to teach cubic. Mention @cubic-dev-ai to give feedback, ask questions, or re-run the review.

const link = document.createElement("a");
link.href = src;
link.download = name || "document.pdf";
link.click();
Copy link

@cubic-dev-ai cubic-dev-ai bot Oct 31, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Programmatic download fails in browsers like Firefox because the anchor is never added to the DOM before click(). Attach it to document.body before triggering the click and remove it afterward.

Prompt for AI agents
Address the following comment on apps/console/src/components/documents/PDFPreview.tsx at line 78:

<comment>Programmatic download fails in browsers like Firefox because the anchor is never added to the DOM before click(). Attach it to document.body before triggering the click and remove it afterward.</comment>

<file context>
@@ -71,6 +71,13 @@ export function PDFPreview({ src, name }: { src: string; name?: string }) {
+    const link = document.createElement(&quot;a&quot;);
+    link.href = src;
+    link.download = name || &quot;document.pdf&quot;;
+    link.click();
+  };
+
</file context>
Fix with Cubic

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It works fine in firefox

Copy link
Contributor

@gearnode gearnode left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@SachaProbo SachaProbo merged commit 7da20b0 into main Nov 3, 2025
10 checks passed
@SachaProbo SachaProbo deleted the fix-document-signature branch November 3, 2025 09:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants